﻿using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;

namespace WebHost
{
    public class EndpointData
    {
        Object _mutex;
        public EndpointData()
        {
            Dirty = false;
            _mutex = new Object();
        }
        /// <summary>
        /// json string
        /// </summary>
        public string Content
        {
            get;set;
        }

        /// <summary>
        /// some times, there is no ppt side listening.
        /// so, when it does, it needs to check whether there is a request
        /// arrived. e.g. a request just arrived, and ppt side just return a
        /// response to 
        /// </summary>
        public bool Dirty
        {
            get;set;
        }
        public override string ToString()
        {
            return Dirty + ":" + Content;
        }
        public void SetContent(string content)
        {
            lock (_mutex)
            {
                Content = content;
                Dirty = true;
            }
        }

        public string GetContent()
        {
            lock (_mutex)
            {
                Dirty = false;
                return Content;
            }
        }
    }
}
